package com.symone.webcms.model;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 系统用户表
 * </p>
 *
 * @author ArcherChu
 * @since 2018-10-30
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_user_table")
@ApiModel(value="系统用户表")
public class User extends Model<User> {

    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @ApiModelProperty(value = "ID")
    @TableId(value = "id", type = IdType.AUTO)
    @NotNull(message = "id不能为空")
    private Long id;
    /**
     * 用户名
     */
    @ApiModelProperty(value="用户名")
    @TableField(value = "user_name")
    @NotNull( message ="用户名不能为空")
    private String userName;

    /**
     * Email
     */
    @ApiModelProperty(value="Email")
    private String email;
    private String mobile;
    @TableField(value = "nick_name")
    private String nickName;
    private String avatar;
    private String notifications;
    private String theme;

    @NotNull( message ="用户名不能为空" )
    private String password;
    @TableField(value = "role_id")
    private Long roleId;
    /**
     * 用户状态[1,正常;9,锁定]
     */
    @ApiModelProperty(value="用户状态[1,正常;9,锁定]")
    private Integer state;

    @TableField(value = "last_login_ip")
    private String lastLoginIp;
    @TableField(value = "last_login_time")
    private Date lastLoginTime;
    @TableField(value = "login_count")
    private Integer loginCount;
    private Integer deleted;
    @TableField(value = "create_time")
    private Date createTime;
    @TableField(value = "update_time")
    private Date updateTime;


    @Override
    protected Serializable pkVal() {
            return this.id;
    }

}